package com.mop.sg2.msg.base;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class MsgContainer {
	private List<MsgConfigBean> msgsList = null;

	private Map<Short, MsgConfigBean> msgsMap = null;

	private static MsgContainer msgContainer = null;

	private MsgContainer() {
		msgsList = new ArrayList<MsgConfigBean>();
		msgsMap = new HashMap<Short, MsgConfigBean>();
	}

	public static MsgContainer getInstance() {
		if (msgContainer == null) {
			msgContainer = new MsgContainer();
		}
		return msgContainer;
	}

	public void put(MsgConfigBean msgConfigBean) {
		msgsList.add(msgConfigBean);
		msgsMap.put(msgConfigBean.getMsgType(), msgConfigBean);
	}

	public MsgConfigBean getMsgConfigBeanById(short id) {
		return msgsMap.get(id);
	}
}
